package com.fulihui.wgj.dal.mybatis.repository;

import com.fulihui.wgj.dal.mybatis.domain.Wx48Attention;
import com.fulihui.wgj.dal.mybatis.mapper.Wx48AttentionMapper;
import org.springframework.stereotype.Component;
import tk.mybatis.mapper.entity.Example;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author wang_wx
 * @date 2018-06-20
 */
@Component
public class Wx48AttentionRepository extends BaseRepository<Wx48Attention> {

    @Resource
    Wx48AttentionMapper wx48AttentionMapper;

    /**
     * 删除48小时互动用户-超过时间
     *
     * @param exceedTime 超出时间
     * @return
     */
    public Integer deleteByLessModified(Date exceedTime) {
        Example example = new Example(Wx48Attention.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andLessThanOrEqualTo("gmtModified", exceedTime);
        return wx48AttentionMapper.deleteByExample(example);
    }
}
